'''
Created on Oct 27, 2013

@author: gjia
'''
import sys

#'print('vjReducer start..')

word2count = { }

for line in sys.stdin:
    line = line.strip()
    # print('lie='+line) 
    word, count = line.split('\t', 1)
    
    try:
        count = int(count)
    except ValueError:
        continue
    
    try:
        word2count[word] = word2count[word] + count
    except:
        word2count[word] = count

for word in word2count.keys():
    print('%s\t%s' % (word, word2count[word])) 